using FireStarterModeller.BO;

namespace FireStarterModeller.Test.BO
{
    public class TestUtilsUITypeDefinition
    {
        /// <summary>
        /// Creates a new saved UITypeDefinition with a random value assigned to every property
        /// </summary>
        public static UITypeDefinition CreateSavedUITypeDefinition()
        {
            UITypeDefinition uITypeDefinition = CreateUnsavedValidUITypeDefinition();
            uITypeDefinition.Save();
            return uITypeDefinition;
        }

        /// <summary>
        /// Creates a new unsaved UITypeDefinition with a random value assigned to every property
        /// </summary>
        public static UITypeDefinition CreateUnsavedValidUITypeDefinition()
        {
            UITypeDefinition uITypeDefinition = new UITypeDefinition();
            uITypeDefinition.AssemblyName = TestUtilsShared.GetRandomString();
            uITypeDefinition.TypeName = TestUtilsShared.GetRandomString();
            uITypeDefinition.Solution = TestUtilsShared.CreateSavedDMSolution();
            uITypeDefinition.TypeDescriminator = TestUtilsShared.GetRandomString();
            return uITypeDefinition;
        }

        /// <summary>
        /// Creates a new unsaved UITypeDefinition where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static UITypeDefinition CreateUnsavedDefaultUITypeDefinition()
        {
            UITypeDefinition uITypeDefinition = new UITypeDefinition();
            return uITypeDefinition;
        }
    }
}